package org.jeecg.controller;


import org.jeecg.domain.Region;
import org.jeecg.domain.dto.ResponseResult;
import org.jeecg.service.RegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/region")
public class RegionController {
    @Autowired
    private RegionService regionService;

//    区域管理列表  分页
//    @CrossOrigin
    @GetMapping("/regionList")
    public ResponseResult regionList(@RequestParam(defaultValue = "1")Integer pageNum,
                                     @RequestParam(defaultValue = "5")Integer pageSize){
      return   regionService.regionList(pageNum,pageSize);
    }
    @PostMapping("/regionListAll")
    public String regionListAll(){
        return "111111111111111";
    }

//    新增区域

    @PostMapping ("/addRegion")
    public ResponseResult addRegion(Region region){
        return regionService.addRegion(region);
    }

//    删除  区域启用后不允许删除

    @PostMapping("/delRegion")
    public ResponseResult delRegion(Region region){
        return regionService.delRegion(region);
    }

//    区域存在上架的服务方可启用区域

    @PostMapping("/qiYongRegion")
    public ResponseResult qiYongRegion(Region region){
    return regionService.qiYongRegion(region);
}
//    修改区域
    @PostMapping("/updateRegion")
    public ResponseResult updateRegion(Region region){
        return regionService.updateRegion(region);
    }
}
